var model = new Model();

function Model() {
    this.options = new Object();
    this.votes = new Object();
}

function Option(id, caption) {
    this.id = id;
    this.caption = caption;
    this.voters = new Array();
    this.containsAnyVoteFrom = _method_containsAnyVoteFrom;
}

function Vote(optionId, participantId, answer) {
    this.optionId = optionId;
    this.participantId = participantId;
    this.answer = answer;
}

function _method_containsAnyVoteFrom(participantId) {
    var participantId_escaped = encodeURIComponent(participantId);
    for ( var idx in this.voters) {
	var voter = this.voters[idx];
	var hasVoted = (voter == participantId_escaped);
	if (hasVoted) {
	    return true;
	}
    }
    return false;
}